import { createRouter, createWebHashHistory } from "vue-router";
import home from "../views/home/index1.vue";
import login from "../views/login/index.vue";
const routes = [
  {
    path: "/",
    name: "",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    component: login,
  },
  {
    path: "/home",
    name: "home",
    component: home,
    redirect: "/home1", // 添加这一行来重定向到/home1

    children: [
      {
        path: "/home1",
        name: "home1",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/pageList/home1.vue"),
      },
      {
        path: "/home2",
        name: "home2",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/pageList/home2.vue"),
      },
      {
        path: "/books",
        name: "books",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/pageList/books.vue"),
      },
      {
        path: "/userBook",
        name: "userBook",
        component: () =>
          import(
            /* webpackChunkName: "about" */ "../views/pageList/userBook.vue"
          ),
      },
      {
        path: "/statistics1",
        name: "statistics1",
        component: () =>
          import(
            /* webpackChunkName: "about" */ "../views/pageList/statistics1.vue"
          ),
      },
      {
        path: "/statistics2",
        name: "statistics2",
        component: () =>
          import(
            /* webpackChunkName: "about" */ "../views/pageList/statistics2.vue"
          ),
      },
    ],
  },

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
